package cn.village.service.impl;
import cn.village.dao.CorporationContractMapper;
import cn.village.entity.CorporationContract;
import cn.village.service.CorporationContractService;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Service
public class CorporationContractServiceImpl implements CorporationContractService {

    @Resource
    private CorporationContractMapper corporationContractMapper;

    public CorporationContract getCorporationContractById(String id)throws Exception{
        return corporationContractMapper.getCorporationContractById(id);
    }

    public List<CorporationContract>	getCorporationContractListByMap(Map<String,Object> param)throws Exception{
        return corporationContractMapper.getCorporationContractListByMap(param);
    }

    public Integer getCorporationContractCountByMap(Map<String,Object> param)throws Exception{
        return corporationContractMapper.getCorporationContractCountByMap(param);
    }

    public Integer qdtxAddCorporationContract(CorporationContract corporationContract)throws Exception{
            //corporationContract.setCreatedTime(new Date());
            return corporationContractMapper.insertCorporationContract(corporationContract);
    }

    public Integer qdtxModifyCorporationContract(CorporationContract corporationContract)throws Exception{
        //corporationContract.setUpdatedTime(new Date());
        return corporationContractMapper.updateCorporationContract(corporationContract);
    }

    public Integer qdtxDeleteCorporationContractById(String id)throws Exception{
        return corporationContractMapper.deleteCorporationContractById(id);
    }

    public Integer qdtxBatchDeleteCorporationContract(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return corporationContractMapper.batchDeleteCorporationContract(param);
    }


}
